<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>小红书趋势分析系统</title>
    <meta name="description" content="智能新媒体计算综合设计 - 小红书创作趋势分析平台" />
    <meta name="keywords" content="小红书,趋势分析,数据可视化,内容创作,AI助手" />
    <meta name="author" content="智能新媒体计算综合设计项目组" />
    
    <!-- 预加载关键资源 -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    
    <!-- 样式预加载 -->
    <style>
      /* 加载动画 */
      #loading {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 9999;
        transition: opacity 0.5s ease-out;
      }
      
      .loading-spinner {
        width: 50px;
        height: 50px;
        border: 4px solid rgba(255, 255, 255, 0.3);
        border-top: 4px solid #fff;
        border-radius: 50%;
        animation: spin 1s linear infinite;
      }
      
      .loading-text {
        color: white;
        font-size: 18px;
        margin-top: 20px;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      }
      
      @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
      }
      
      /* 隐藏加载动画 */
      .loading-hidden {
        opacity: 0;
        pointer-events: none;
      }
      
      /* 基础样式重置 */
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }
      
      body {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
        background-color: #f0f2f5;
        color: #262626;
        line-height: 1.6;
      }
      
      /* 防止闪烁 */
      #root {
        min-height: 100vh;
      }
    </style>
  </head>
  <body>
    <!-- 加载动画 -->
    <div id="loading">
      <div style="text-align: center;">
        <div class="loading-spinner"></div>
        <div class="loading-text">小红书趋势分析系统加载中...</div>
      </div>
    </div>
    
    <!-- React 应用挂载点 -->
    <div id="root"></div>
    
    <!-- 主应用脚本 -->
    <script type="module" src="/src/main.tsx"></script>
    
    <!-- 加载完成后隐藏动画 -->
    <script>
      window.addEventListener('load', function() {
        setTimeout(function() {
          const loading = document.getElementById('loading');
          if (loading) {
            loading.classList.add('loading-hidden');
            setTimeout(function() {
              loading.style.display = 'none';
            }, 500);
          }
        }, 1000);
      });
      
      // 错误处理
      window.addEventListener('error', function(e) {
        console.error('应用加载错误:', e.error);
      });
      
      // 未处理的 Promise 错误
      window.addEventListener('unhandledrejection', function(e) {
        console.error('未处理的 Promise 错误:', e.reason);
      });
    </script>
  </body>
</html>
